package com.eveinfo.api.utils.nametoid;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.eveinfo.api.AbstractApiHandler;

public class NameToIdHandler extends AbstractApiHandler<ApiNameToId> {
	
	public NameToIdHandler() {
		super();
		response = new ApiNameToId();
	}
	
	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		super.startElement(uri, localName, qName, attributes);
		String value = (!localName.equals("")) ? localName : qName;
		if (value.equals("row")) {
			response.setName(attributes.getValue("name"));
			response.setCharacterID(Integer.parseInt(attributes.getValue("characterID")));
		}
	}

}
